package com.grts.mall.controller;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.grts.mall.common.CommonResult;
import com.grts.mall.pojo.vo.HomeResultVo;
import com.grts.mall.service.OrderService;

@Controller
public class HomeController {

	@Autowired
	private OrderService orderService;

	@RequestMapping("/home")
	public String home(Date date) {
		return "home";
	}

	@RequestMapping("/orderall")
	@ResponseBody
	public CommonResult findBytime() {
		List<HomeResultVo> list = this.orderService.findByDay();
		return CommonResult.success(list);
	}

	@SuppressWarnings("deprecation")
	@RequestMapping("/orderbytime")
	@ResponseBody
	public CommonResult findResult(String date) throws ParseException {
		this.orderService.findBytime(date);
		return null;
	}

}
